<!DOCTYPE HTML>
<html>
<head>
    <link href="favicon.ico"  rel="shortcut icon" type="image/x-icon" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta http-equiv="pragma" content="no-cache">
    <title>jspx.net-API参考手册</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script type="text/javascript" src="scripts/jquery-1.12.4.js"></script>
    <link type="text/css" rel="stylesheet" href="styles/jspxnet-ui.css"/>
    <link href="styles/docs.css" rel="stylesheet" type="text/css" media="screen"/>
    <script src="../../script/jbCommon.js"></script>
    <script type="text/javascript" src="scripts/mootools.js"></script>
    <script type="text/javascript" src="scripts/jspxnet.js"></script>
    <script type="text/javascript" src="scripts/jspxnet-ui.js"></script>
    <style>
        .searchPanel{
            position: relative;
        }
        .searchPanel ul{
            position: absolute;
            display: none;
            min-width: 300px;
            padding: 0 0 20px;
            top: 20px;
            left: 0;
            right: 0;
            margin: auto;
            border: 1px solid #999999;
            background-color: pink;
            text-align: center;
        }
        .menuItems .current{
            font-weight: bold;
        }
    </style>
</head>
<body>
<div id="container">
    <div id="header">
        <h1><span id="appName">{{ appname }}</span> API 参考手册 </h1>
        <div class="searchPanel">
            <input id="search" type="text" placeholder="搜索类对象名称">
            <button>搜索</button>
            <ul id="result">
                <div>以下为搜索结果</div>
            </ul>
        </div>
    </div>
    <div id="menu">
        <div class="span-4 menulist">
            <h4><img src="images/jspx.net.gif" width="140" height="55"></h4>
            <div id="main-menu" v-cloak>
                <ul id="tabCardTit" class="tabMenu">
                    <li>接口</li>
                    <li>字段</li>
                </ul>
                <ol id="tabCardCon" class="menuItems">
                    <div id="menuIndex">
                        <li v-for="m in indexing" @click="itemClick();" class="item"><a target="content" :href="['document.html?id='+m.id]">{{m.title}}</a></li>
                    </div>
                    <div id="menuTable">
                        <li v-for="m in fielding" @click="itemClick();" class="item"><a target="content" :href="['table.html?id='+m.id]">{{m.title}}</a></li>
                    </div>
                </ol>
            </div>
        </div>
    </div>
    <iframe name="content" id="content" class="dcont" frameborder="0" allowtransparency="true" src="readme.md"></iframe>
    <div id="footer">
        <div class="container">
            <p class="quiet">&copy;2007-2021 <a href="http://www.jspx.net" target="_blank">www.jspx.net</a>作者:陈原&nbsp;&nbsp;邮件:39793751@qq.com</p>
        </div>
    </div>
</div>
<script type="text/javascript" src="scripts/doc-top.js"></script>
<script>
    var vm = new Vue({
        el:"#container",
        data:{
            appname:"",
            indexing:[],
            fielding:[],
        },
        methods:{
            getTitle:function() {
                var vm = this;
                new Request.ROC({
                    'url': 'appname.jwc',
                    onSuccess: function (obj) {
                        if (obj.success) {
                            vm.appname = obj.data;
                        } else {
                            $('appName').adopt(obj.message);
                        }
                    }
                }).send();
            },
            getIndexing:function() {
		
                var vm = this;
                new Request.ROC({
                    'url': 'indexing.jwc',
                    onSuccess: function (obj) {
                        if (obj.success)
                        {
                            vm.indexing = obj.data;
                            search(obj.data);
                        } else {
                            $('menuIndex').adopt(obj.message);
                        }
                    }
                }).send();
            },
            getFielding:function() {
                var vm = this;
                new Request.ROC({
                    'url': 'fielding.jwc',
                    onSuccess: function (obj) {
                        if (obj.success) {
                            vm.fielding = obj.data;
                        } else {
                            $('menuTable').adopt(obj.message);
                        }
                        buildTab.delay(500);
                    }
                }).send();
            },
            itemClick:function(){
                var li = jQuery(event.target).parents("li");
                li.siblings().removeClass("selected");
                li.addClass("selected");
            }
        },
        created:function(){
            this.getTitle();
            this.getIndexing();
            this.getFielding();
        }
    });
    var buildTab=function() {
        new JTabs({
            buttons:'#main-menu ul li',
            contexts: $$('ol.menuItems div'),
            buttonCss: 'tabButton',
            buttonCurrentCss: 'tabButton_current'
        });
    };
    //yql新增搜索框函数-begin
    function search(data){
        var boxEle = jQuery("#search");
        var data = data;
        var resultEle = jQuery("#result");
        var val;

        boxEle.focus(function () {
            resultEle.slideDown();
        });
        boxEle.blur(function () {
            setTimeout(function () {
                resultEle.slideUp();
            },500)
        })
        boxEle.keyup(function () {
            resultEle.children().remove("li");
            val = jQuery(this).val();
            jQuery.each(data,function (index,item) {
                if (val && item.className.indexOf(val) >= 0 || item.title.indexOf(val) >= 0){
                    var url = "document.html?id="+item.id;
                    var itemEl = jQuery("<li></li>").append(jQuery("<a target='content' ></a>").append('[' + item.title+ ']' + item.className).attr("href",url));
                    resultEle.append(itemEl);
                }
            })
        })
    }
    //yql新增搜索框函数-end
</script>
</body>
</html>
